WPS Office.apk(点击下载) / fbv.java


package defpackage;

import android.content.Context;
import android.text.TextUtils;
import cn.wps.moffice.OfficeApp;
import cn.wps.moffice.foreigntemplate.bean.EnTemplateBean;
import cn.wps.moffice.foreigntemplate.bean.UrlBean;
import cn.wps.shareplay.message.Message;
import com.google.gson.reflect.TypeToken;
import com.iflytek.cloud.SpeechUtility;
import java.lang.ref.SoftReference;
import java.text.MessageFormat;
import java.util.ArrayList;
import org.json.JSONObject;

/* renamed from: fbv  reason: default package */
public class fbv {
    private static SoftReference<fbv> fAN;
    public hwh fAO = hwi.AW(2);

    private fbv() {
    }

    public static log a(log log) {
        return ebo.arU() ? log.eT("Cookie", "wps_sid=" + fok.bBq().getWPSSid()) : log;
    }

    public static void a(Context context, hwe hwe, boolean z) {
        hsz ua;
        if (htc.ckx() && htc.ckq() && z) {
            String fd = htc.fd(context);
            if (!TextUtils.isEmpty(fd) && (ua = hth.ua(fd)) != null) {
                String str = ua.iMV;
                if (!TextUtils.isEmpty(str)) {
                    hwe.dk("country", str);
                }
            }
        }
        hwe.dk("platform", "ANDROID");
    }

    public static fbv btv() {
        if (fAN == null || fAN.get() == null) {
            synchronized (fbv.class) {
                if (fAN == null || fAN.get() == null) {
                    fAN = new SoftReference<>(new fbv());
                }
            }
        }
        return fAN.get();
    }

    public final log<ArrayList<EnTemplateBean>> a(Context context, String str, String str2, String str3, String str4, int i, int i2, String str5) {
        hwe hwe = new hwe();
        if (!TextUtils.isEmpty(str)) {
            hwe.dk("category_id", str);
        }
        if (!TextUtils.isEmpty(str2)) {
            hwe.dk("tag_id", str2);
        }
        if (!TextUtils.isEmpty(str3)) {
            hwe.dk("keyword", str3);
        }
        if (!TextUtils.isEmpty(str4)) {
            hwe.dk("format", str4);
        }
        if (!TextUtils.isEmpty(str5)) {
            hwe.dk("sort_field", str5);
        }
        a(context, hwe, true);
        hwe.dk("start", String.valueOf(i));
        hwe.dk("limit", String.valueOf(i2));
        return new lof(context).Lr(0).HX("http://api.docer.4wps.net/template/query").b(new TypeToken<ArrayList<EnTemplateBean>>() {
            /* class defpackage.fbv.AnonymousClass6 */
        }.getType()).u(hwe.cmr());
    }

    public final log<UrlBean> aF(Context context, String str) {
        hwe hwe = new hwe();
        hwe.dk("tid", str);
        a(context, hwe, false);
        return a(new lof(context).Lr(0).HX(MessageFormat.format("http://api.docer.4wps.net/template/{0}/download", str)).b(new TypeToken<UrlBean>() {
            /* class defpackage.fbv.AnonymousClass19 */
        }.getType()).u(hwe.cmr()));
    }

    public final log<EnTemplateBean> aG(Context context, String str) {
        hwe hwe = new hwe();
        a(context, hwe, false);
        return a(new lof(context).Lr(0).HX("http://api.docer.4wps.net/template/" + str).b(new TypeToken<EnTemplateBean>() {
            /* class defpackage.fbv.AnonymousClass10 */
        }.getType()).u(hwe.cmr()));
    }

    public final log<ArrayList<EnTemplateBean>> b(Context context, int i, int i2, String str) {
        return a(context, "", "", "", "", i, 10, str);
    }

    public final log<Integer> cq(Context context) {
        String bE = ebo.bE(OfficeApp.arx());
        hwe hwe = new hwe();
        hwe.dk("account", bE);
        hwe.dk("version", "2");
        this.fAO.a(hwe);
        return new log(context).HX("https://movip.wps.com/template/v2/user/credits").b(new TypeToken<Integer>() {
            /* class defpackage.fbv.AnonymousClass14 */
        }.getType()).u(hwe.cmr());
    }

    public final boolean pH(String str) throws Exception {
        String str2;
        String str3;
        String str4 = "";
        ebl aSr = ebo.aSr();
        if (aSr != null) {
            try {
                str4 = aSr.aSi().split(Message.SEPARATE2)[0];
            } catch (Exception e) {
                e.printStackTrace();
            }
            str2 = str4;
            str3 = aSr.getUserId();
        } else {
            str2 = str4;
            str3 = "";
        }
        hwe hwe = new hwe();
        hwe.dk("account", str);
        hwe.dk("wpsid", str3);
        hwe.dk("loginMode", str2);
        this.fAO.a(hwe);
        return "ok".equalsIgnoreCase(new JSONObject(dnd.a("https://movip.wps.com/template/v2/user/bind2wpsid", hwe.cmq(), null)).getString(SpeechUtility.TAG_RESOURCE_RESULT));
    }
}